// 旋转数组其实是由两个有序数组拼接而成的，因此我们可以使用二分法，只需要找到拼接点即可。

const arr = [3, 4, 5, 6, 0, 1, 2]

function minNumberInRotateArray(array) {
    let len = array.length;
    if (len == 0) return 0;
    let low = 0,
        high = len - 1;
    while (low < high) {
        let mid = low + Math.floor((high - low) / 2);
        if (array[mid] > array[high]) {
            low = mid + 1;
        } else if (array[mid] == array[high]) {
            high = high - 1;
        } else {
            high = mid;
        }
    }

    return array[low];
}

console.log(minNumberInRotateArray(arr))